<div class="modal-header success">
    <h4 class="modal-title" id="modal-title">
        Create JWT
        <a  class="modal-close pull-right" ng-click="close()">
            <i class="mdi mdi-close"></i>
        </a>
    </h4>
</div>
<div class="col-md-12 bg-light-grey padding">
    <p class="text-muted no-margin">Create JWT for <strong><span class="text-success">{{consumer.username || consumer.custom_id}}</span></strong></p>
</div>

<div class="modal-body" id="modal-body">
    <form class="form-horizontal">
        <div class="form-group" ng-class="{'has-error' : errors.key}">
            <label class="col-sm-4 control-label">key <br><em><small class="help-block">optional</small></em></label>
            <div class="col-sm-7">
                <input ng-model="jwt.key" class="form-control">
                <div class="text-danger" ng-if="errors.key" data-ng-bind="errors.key"></div>
                <p class="help-block">A unique string identifying the credential. If left out, it will be auto-generated. However, usage of this key is <strong>mandatory</strong> while crafting your token, as specified in the next section.</p>
            </div>
        </div>


        <div class="form-group" ng-class="{'has-error' : errors.algorithm}">
            <label class="col-sm-4 control-label">algorithm <br><em><small class="help-block">optional</small></em></label>
            <div class="col-sm-7">
                <select ng-model="jwt.algorithm" class="form-control">
                    <option value="HS256">HS256</option>
                    <option value="RS256">RS256</option>
                </select>
                <div class="text-danger" ng-if="errors.algorithm" data-ng-bind="errors.algorithm"></div>
                <p class="help-block">The algorithm used to verify the token's signature. Can be <code>HS256</code> or <code>RS256</code>.</p>
            </div>
        </div>


        <div class="form-group" ng-class="{'has-error' : errors.rsa_public_key}">
            <label class="col-sm-4 control-label">rsa_public_key <br><em><small class="help-block">optional</small></em></label>
            <div class="col-sm-7">
                <textarea ng-model="jwt.rsa_public_key" class="form-control" />
                <div class="text-danger" ng-if="errors.rsa_public_key" data-ng-bind="errors.rsa_public_key"></div>
                <p class="help-block">If <code>algorithm</code> is <code>RS256</code>, the public key (in PEM format) to use to verify the token's signature.</p>
            </div>
        </div>


        <div class="form-group" ng-class="{'has-error' : errors.secret}">
            <label class="col-sm-4 control-label">secret <br><em><small class="help-block">optional</small></em></label>
            <div class="col-sm-7">
                <input ng-model="jwt.secret" class="form-control">
                <div class="text-danger" ng-if="errors.secret" data-ng-bind="errors.secret"></div>
                <p class="help-block">If <code>algorithm</code> is <code>HS256</code>, the secret used to sign JWTs for this credential. If left out, will be auto-generated. If <code>algorithm</code> is <code>RS256</code>, this is the private key (in PEM format) to use to verify the token's signature.</p>
            </div>
        </div>


        <div class="form-group">
            <div class="col-sm-offset-4 col-sm-7">
                <button type="submit" class="btn btn-primary" ng-click="createJWT()">
                    <i class="mdi mdi-check"></i>
                    Submit
                </button>
            </div>
        </div>

    </form>
</div>
